<?php

// Global variable for table object
$planoperaciones = NULL;

//
// Table class for planoperaciones
//
class cplanoperaciones extends cTable {
	var $Id;
	var $Fecha;
	var $Plan;
	var $Estado;
	var $Descripcion;
	var $Origen;
	var $Destino;
	var $Chofer;
	var $Vehiculo;
	var $Pedido;
	var $Carga;
	var $Descarga;
	var $Retorno;
	var $Observacion;
	var $MostrarObservacion;
	var $FechaActualizacion;

	//
	// Table class constructor
	//
	function __construct() {
		global $Language;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();
		$this->TableVar = 'planoperaciones';
		$this->TableName = 'planoperaciones';
		$this->TableType = 'TABLE';
		$this->ExportAll = TRUE;
		$this->ExportPageBreakCount = 0; // Page break per every n record (PDF only)
		$this->ExportPageOrientation = "portrait"; // Page orientation (PDF only)
		$this->ExportPageSize = "a4"; // Page size (PDF only)
		$this->DetailAdd = FALSE; // Allow detail add
		$this->DetailEdit = FALSE; // Allow detail edit
		$this->DetailView = FALSE; // Allow detail view
		$this->ShowMultipleDetails = FALSE; // Show multiple details
		$this->GridAddRowCount = 5;
		$this->AllowAddDeleteRow = ew_AllowAddDeleteRow(); // Allow add/delete row
		$this->UserIDAllowSecurity = 0; // User ID Allow
		$this->BasicSearch = new cBasicSearch($this->TableVar);

		// Id
		$this->Id = new cField('planoperaciones', 'planoperaciones', 'x_Id', 'Id', '`Id`', '`Id`', 3, -1, FALSE, '`Id`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Id->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Id'] = &$this->Id;

		// Fecha
		$this->Fecha = new cField('planoperaciones', 'planoperaciones', 'x_Fecha', 'Fecha', '`Fecha`', 'DATE_FORMAT(`Fecha`, \'%d/%m/%Y\')', 133, 7, FALSE, '`Fecha`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Fecha->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['Fecha'] = &$this->Fecha;

		// Plan
		$this->Plan = new cField('planoperaciones', 'planoperaciones', 'x_Plan', 'Plan', '`Plan`', '`Plan`', 3, 7, FALSE, '`Plan`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Plan->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Plan'] = &$this->Plan;

		// Estado
		$this->Estado = new cField('planoperaciones', 'planoperaciones', 'x_Estado', 'Estado', '`Estado`', '`Estado`', 3, -1, FALSE, '`Estado`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Estado->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Estado'] = &$this->Estado;

		// Descripcion
		$this->Descripcion = new cField('planoperaciones', 'planoperaciones', 'x_Descripcion', 'Descripcion', '`Descripcion`', '`Descripcion`', 200, -1, FALSE, '`Descripcion`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['Descripcion'] = &$this->Descripcion;

		// Origen
		$this->Origen = new cField('planoperaciones', 'planoperaciones', 'x_Origen', 'Origen', '`Origen`', '`Origen`', 3, -1, FALSE, '`Origen`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Origen->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Origen'] = &$this->Origen;

		// Destino
		$this->Destino = new cField('planoperaciones', 'planoperaciones', 'x_Destino', 'Destino', '`Destino`', '`Destino`', 3, -1, FALSE, '`Destino`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Destino->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Destino'] = &$this->Destino;

		// Chofer
		$this->Chofer = new cField('planoperaciones', 'planoperaciones', 'x_Chofer', 'Chofer', '`Chofer`', '`Chofer`', 3, -1, FALSE, '`Chofer`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Chofer->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Chofer'] = &$this->Chofer;

		// Vehiculo
		$this->Vehiculo = new cField('planoperaciones', 'planoperaciones', 'x_Vehiculo', 'Vehiculo', '`Vehiculo`', '`Vehiculo`', 3, -1, FALSE, '`Vehiculo`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Vehiculo->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['Vehiculo'] = &$this->Vehiculo;

		// Pedido
		$this->Pedido = new cField('planoperaciones', 'planoperaciones', 'x_Pedido', 'Pedido', '`Pedido`', 'DATE_FORMAT(`Pedido`, \'%d/%m/%Y\')', 135, 11, FALSE, '`Pedido`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Pedido->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['Pedido'] = &$this->Pedido;

		// Carga
		$this->Carga = new cField('planoperaciones', 'planoperaciones', 'x_Carga', 'Carga', '`Carga`', 'DATE_FORMAT(`Carga`, \'%d/%m/%Y\')', 135, 11, FALSE, '`Carga`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Carga->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['Carga'] = &$this->Carga;

		// Descarga
		$this->Descarga = new cField('planoperaciones', 'planoperaciones', 'x_Descarga', 'Descarga', '`Descarga`', 'DATE_FORMAT(`Descarga`, \'%d/%m/%Y\')', 135, 11, FALSE, '`Descarga`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Descarga->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['Descarga'] = &$this->Descarga;

		// Retorno
		$this->Retorno = new cField('planoperaciones', 'planoperaciones', 'x_Retorno', 'Retorno', '`Retorno`', 'DATE_FORMAT(`Retorno`, \'%d/%m/%Y\')', 135, 11, FALSE, '`Retorno`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->Retorno->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['Retorno'] = &$this->Retorno;

		// Observacion
		$this->Observacion = new cField('planoperaciones', 'planoperaciones', 'x_Observacion', 'Observacion', '`Observacion`', '`Observacion`', 200, -1, FALSE, '`Observacion`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->fields['Observacion'] = &$this->Observacion;

		// MostrarObservacion
		$this->MostrarObservacion = new cField('planoperaciones', 'planoperaciones', 'x_MostrarObservacion', 'MostrarObservacion', '`MostrarObservacion`', '`MostrarObservacion`', 3, -1, FALSE, '`MostrarObservacion`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->MostrarObservacion->FldDefaultErrMsg = $Language->Phrase("IncorrectInteger");
		$this->fields['MostrarObservacion'] = &$this->MostrarObservacion;

		// FechaActualizacion
		$this->FechaActualizacion = new cField('planoperaciones', 'planoperaciones', 'x_FechaActualizacion', 'FechaActualizacion', '`FechaActualizacion`', 'DATE_FORMAT(`FechaActualizacion`, \'%d/%m/%Y\')', 135, 11, FALSE, '`FechaActualizacion`', FALSE, FALSE, FALSE, 'FORMATTED TEXT');
		$this->FechaActualizacion->FldDefaultErrMsg = str_replace("%s", "/", $Language->Phrase("IncorrectDateDMY"));
		$this->fields['FechaActualizacion'] = &$this->FechaActualizacion;
	}

	// Single column sort
	function UpdateSort(&$ofld) {
		if ($this->CurrentOrder == $ofld->FldName) {
			$sSortField = $ofld->FldExpression;
			$sLastSort = $ofld->getSort();
			if ($this->CurrentOrderType == "ASC" || $this->CurrentOrderType == "DESC") {
				$sThisSort = $this->CurrentOrderType;
			} else {
				$sThisSort = ($sLastSort == "ASC") ? "DESC" : "ASC";
			}
			$ofld->setSort($sThisSort);
			$this->setSessionOrderBy($sSortField . " " . $sThisSort); // Save to Session
		} else {
			$ofld->setSort("");
		}
	}

	// Current master table name
	function getCurrentMasterTable() {
		return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_MASTER_TABLE];
	}

	function setCurrentMasterTable($v) {
		$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_MASTER_TABLE] = $v;
	}

	// Session master WHERE clause
	function GetMasterFilter() {

		// Master filter
		$sMasterFilter = "";
		if ($this->getCurrentMasterTable() == "plansemanal") {
			if ($this->Plan->getSessionValue() <> "")
				$sMasterFilter .= "`PlanId`=" . ew_QuotedValue($this->Plan->getSessionValue(), EW_DATATYPE_NUMBER);
			else
				return "";
		}
		return $sMasterFilter;
	}

	// Session detail WHERE clause
	function GetDetailFilter() {

		// Detail filter
		$sDetailFilter = "";
		if ($this->getCurrentMasterTable() == "plansemanal") {
			if ($this->Plan->getSessionValue() <> "")
				$sDetailFilter .= "`Plan`=" . ew_QuotedValue($this->Plan->getSessionValue(), EW_DATATYPE_NUMBER);
			else
				return "";
		}
		return $sDetailFilter;
	}

	// Master filter
	function SqlMasterFilter_plansemanal() {
		return "`PlanId`=@PlanId@";
	}

	// Detail filter
	function SqlDetailFilter_plansemanal() {
		return "`Plan`=@Plan@";
	}

	// Current detail table name
	function getCurrentDetailTable() {
		return @$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_DETAIL_TABLE];
	}

	function setCurrentDetailTable($v) {
		$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_DETAIL_TABLE] = $v;
	}

	// Get detail url
	function GetDetailUrl() {

		// Detail url
		$sDetailUrl = "";
		if ($this->getCurrentDetailTable() == "pedidoplan") {
			$sDetailUrl = $GLOBALS["pedidoplan"]->GetListUrl() . "?showmaster=" . $this->TableVar;
			$sDetailUrl .= "&Plan=" . $this->Id->CurrentValue;
		}
		if ($sDetailUrl == "") {
			$sDetailUrl = "planoperacioneslist.php";
		}
		return $sDetailUrl;
	}

	// Table level SQL
	function SqlFrom() { // From
		return "`planoperaciones`";
	}

	function SqlSelect() { // Select
		return "SELECT * FROM " . $this->SqlFrom();
	}

	function SqlWhere() { // Where
		$sWhere = "";
		$this->TableFilter = "";
		ew_AddFilter($sWhere, $this->TableFilter);
		return $sWhere;
	}

	function SqlGroupBy() { // Group By
		return "";
	}

	function SqlHaving() { // Having
		return "";
	}

	function SqlOrderBy() { // Order By
		return "`Id` DESC";
	}

	// Check if Anonymous User is allowed
	function AllowAnonymousUser() {
		switch (@$this->PageID) {
			case "add":
			case "register":
			case "addopt":
				return FALSE;
			case "edit":
			case "update":
			case "changepwd":
			case "forgotpwd":
				return FALSE;
			case "delete":
				return FALSE;
			case "view":
				return FALSE;
			case "search":
				return FALSE;
			default:
				return FALSE;
		}
	}

	// Apply User ID filters
	function ApplyUserIDFilters($sFilter) {
		return $sFilter;
	}

	// Check if User ID security allows view all
	function UserIDAllow($id = "") {
		$allow = EW_USER_ID_ALLOW;
		switch ($id) {
			case "add":
			case "copy":
			case "gridadd":
			case "register":
			case "addopt":
				return (($allow & 1) == 1);
			case "edit":
			case "gridedit":
			case "update":
			case "changepwd":
			case "forgotpwd":
				return (($allow & 4) == 4);
			case "delete":
				return (($allow & 2) == 2);
			case "view":
				return (($allow & 8) == 8);
			case "search":
				return (($allow & 8) == 8);
			default:
				return (($allow & 8) == 8);
		}
	}

	// Get SQL
	function GetSQL($where, $orderby) {
		return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(),
			$this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(),
			$where, $orderby);
	}

	// Table SQL
	function SQL() {
		$sFilter = $this->CurrentFilter;
		$sFilter = $this->ApplyUserIDFilters($sFilter);
		$sSort = $this->getSessionOrderBy();
		return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(),
			$this->SqlGroupBy(), $this->SqlHaving(), $this->SqlOrderBy(),
			$sFilter, $sSort);
	}

	// Table SQL with List page filter
	function SelectSQL() {
		$sFilter = $this->getSessionWhere();
		ew_AddFilter($sFilter, $this->CurrentFilter);
		$sFilter = $this->ApplyUserIDFilters($sFilter);
		$sSort = $this->getSessionOrderBy();
		return ew_BuildSelectSql($this->SqlSelect(), $this->SqlWhere(), $this->SqlGroupBy(),
			$this->SqlHaving(), $this->SqlOrderBy(), $sFilter, $sSort);
	}

	// Get ORDER BY clause
	function GetOrderBy() {
		$sSort = $this->getSessionOrderBy();
		return ew_BuildSelectSql("", "", "", "", $this->SqlOrderBy(), "", $sSort);
	}

	// Try to get record count
	function TryGetRecordCount($sSql) {
		global $conn;
		$cnt = -1;
		if ($this->TableType == 'TABLE' || $this->TableType == 'VIEW') {
			$sSql = "SELECT COUNT(*) FROM" . substr($sSql, 13);
			$sOrderBy = $this->GetOrderBy();
			if (substr($sSql, strlen($sOrderBy) * -1) == $sOrderBy)
				$sSql = substr($sSql, 0, strlen($sSql) - strlen($sOrderBy)); // Remove ORDER BY clause
		} else {
			$sSql = "SELECT COUNT(*) FROM (" . $sSql . ") EW_COUNT_TABLE";
		}
		if ($rs = $conn->Execute($sSql)) {
			if (!$rs->EOF && $rs->FieldCount() > 0) {
				$cnt = $rs->fields[0];
				$rs->Close();
			}
		}
		return intval($cnt);
	}

	// Get record count based on filter (for detail record count in master table pages)
	function LoadRecordCount($sFilter) {
		$origFilter = $this->CurrentFilter;
		$this->CurrentFilter = $sFilter;
		$this->Recordset_Selecting($this->CurrentFilter);

		//$sSql = $this->SQL();
		$sSql = $this->GetSQL($this->CurrentFilter, "");
		$cnt = $this->TryGetRecordCount($sSql);
		if ($cnt == -1) {
			if ($rs = $this->LoadRs($this->CurrentFilter)) {
				$cnt = $rs->RecordCount();
				$rs->Close();
			}
		}
		$this->CurrentFilter = $origFilter;
		return intval($cnt);
	}

	// Get record count (for current List page)
	function SelectRecordCount() {
		global $conn;
		$origFilter = $this->CurrentFilter;
		$this->Recordset_Selecting($this->CurrentFilter);
		$sSql = $this->SelectSQL();
		$cnt = $this->TryGetRecordCount($sSql);
		if ($cnt == -1) {
			if ($rs = $conn->Execute($sSql)) {
				$cnt = $rs->RecordCount();
				$rs->Close();
			}
		}
		$this->CurrentFilter = $origFilter;
		return intval($cnt);
	}

	// Update Table
	var $UpdateTable = "`planoperaciones`";

	// INSERT statement
	function InsertSQL(&$rs) {
		global $conn;
		$names = "";
		$values = "";
		foreach ($rs as $name => $value) {
			if (!isset($this->fields[$name]))
				continue;
			$names .= $this->fields[$name]->FldExpression . ",";
			$values .= ew_QuotedValue($value, $this->fields[$name]->FldDataType) . ",";
		}
		while (substr($names, -1) == ",")
			$names = substr($names, 0, -1);
		while (substr($values, -1) == ",")
			$values = substr($values, 0, -1);
		return "INSERT INTO " . $this->UpdateTable . " ($names) VALUES ($values)";
	}

	// Insert
	function Insert(&$rs) {
		global $conn;
		return $conn->Execute($this->InsertSQL($rs));
	}

	// UPDATE statement
	function UpdateSQL(&$rs, $where = "") {
		$sql = "UPDATE " . $this->UpdateTable . " SET ";
		foreach ($rs as $name => $value) {
			if (!isset($this->fields[$name]))
				continue;
			$sql .= $this->fields[$name]->FldExpression . "=";
			$sql .= ew_QuotedValue($value, $this->fields[$name]->FldDataType) . ",";
		}
		while (substr($sql, -1) == ",")
			$sql = substr($sql, 0, -1);
		$filter = $this->CurrentFilter;
		ew_AddFilter($filter, $where);
		if ($filter <> "")	$sql .= " WHERE " . $filter;
		return $sql;
	}

	// Update
	function Update(&$rs, $where = "", $rsold = NULL) {
		global $conn;
		return $conn->Execute($this->UpdateSQL($rs, $where));
	}

	// DELETE statement
	function DeleteSQL(&$rs, $where = "") {
		$sql = "DELETE FROM " . $this->UpdateTable . " WHERE ";
		if ($rs) {
			if (array_key_exists('Id', $rs))
				ew_AddFilter($where, ew_QuotedName('Id') . '=' . ew_QuotedValue($rs['Id'], $this->Id->FldDataType));
		}
		$filter = $this->CurrentFilter;
		ew_AddFilter($filter, $where);
		if ($filter <> "")
			$sql .= $filter;
		else
			$sql .= "0=1"; // Avoid delete
		return $sql;
	}

	// Delete
	function Delete(&$rs, $where = "") {
		global $conn;
		return $conn->Execute($this->DeleteSQL($rs, $where));
	}

	// Key filter WHERE clause
	function SqlKeyFilter() {
		return "`Id` = @Id@";
	}

	// Key filter
	function KeyFilter() {
		$sKeyFilter = $this->SqlKeyFilter();
		if (!is_numeric($this->Id->CurrentValue))
			$sKeyFilter = "0=1"; // Invalid key
		$sKeyFilter = str_replace("@Id@", ew_AdjustSql($this->Id->CurrentValue), $sKeyFilter); // Replace key value
		return $sKeyFilter;
	}

	// Return page URL
	function getReturnUrl() {
		$name = EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL;

		// Get referer URL automatically
		if (ew_ServerVar("HTTP_REFERER") <> "" && ew_ReferPage() <> ew_CurrentPage() && ew_ReferPage() <> "login.php") // Referer not same page or login page
			$_SESSION[$name] = ew_ServerVar("HTTP_REFERER"); // Save to Session
		if (@$_SESSION[$name] <> "") {
			return $_SESSION[$name];
		} else {
			return "planoperacioneslist.php";
		}
	}

	function setReturnUrl($v) {
		$_SESSION[EW_PROJECT_NAME . "_" . $this->TableVar . "_" . EW_TABLE_RETURN_URL] = $v;
	}

	// List URL
	function GetListUrl() {
		return "planoperacioneslist.php";
	}

	// View URL
	function GetViewUrl($parm = "") {
		if ($parm <> "")
			return $this->KeyUrl("planoperacionesview.php", $this->UrlParm($parm));
		else
			return $this->KeyUrl("planoperacionesview.php", $this->UrlParm(EW_TABLE_SHOW_DETAIL . "="));
	}

	// Add URL
	function GetAddUrl() {
		return "planoperacionesadd.php";
	}

	// Edit URL
	function GetEditUrl($parm = "") {
		if ($parm <> "")
			return $this->KeyUrl("planoperacionesedit.php", $this->UrlParm($parm));
		else
			return $this->KeyUrl("planoperacionesedit.php", $this->UrlParm(EW_TABLE_SHOW_DETAIL . "="));
	}

	// Inline edit URL
	function GetInlineEditUrl() {
		return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=edit"));
	}

	// Copy URL
	function GetCopyUrl($parm = "") {
		if ($parm <> "")
			return $this->KeyUrl("planoperacionesadd.php", $this->UrlParm($parm));
		else
			return $this->KeyUrl("planoperacionesadd.php", $this->UrlParm(EW_TABLE_SHOW_DETAIL . "="));
	}

	// Inline copy URL
	function GetInlineCopyUrl() {
		return $this->KeyUrl(ew_CurrentPage(), $this->UrlParm("a=copy"));
	}

	// Delete URL
	function GetDeleteUrl() {
		return $this->KeyUrl("planoperacionesdelete.php", $this->UrlParm());
	}

	// Add key value to URL
	function KeyUrl($url, $parm = "") {
		$sUrl = $url . "?";
		if ($parm <> "") $sUrl .= $parm . "&";
		if (!is_null($this->Id->CurrentValue)) {
			$sUrl .= "Id=" . urlencode($this->Id->CurrentValue);
		} else {
			return "javascript:alert(ewLanguage.Phrase('InvalidRecord'));";
		}
		return $sUrl;
	}

	// Sort URL
	function SortUrl(&$fld) {
		if ($this->CurrentAction <> "" || $this->Export <> "" ||
			in_array($fld->FldType, array(128, 204, 205))) { // Unsortable data type
				return "";
		} elseif ($fld->Sortable) {
			$sUrlParm = $this->UrlParm("order=" . urlencode($fld->FldName) . "&amp;ordertype=" . $fld->ReverseSort());
			return ew_CurrentPage() . "?" . $sUrlParm;
		} else {
			return "";
		}
	}

	// Get record keys from $_POST/$_GET/$_SESSION
	function GetRecordKeys() {
		global $EW_COMPOSITE_KEY_SEPARATOR;
		$arKeys = array();
		$arKey = array();
		if (isset($_POST["key_m"])) {
			$arKeys = ew_StripSlashes($_POST["key_m"]);
			$cnt = count($arKeys);
		} elseif (isset($_GET["key_m"])) {
			$arKeys = ew_StripSlashes($_GET["key_m"]);
			$cnt = count($arKeys);
		} elseif (isset($_GET)) {
			$arKeys[] = @$_GET["Id"]; // Id

			//return $arKeys; // Do not return yet, so the values will also be checked by the following code
		}

		// Check keys
		$ar = array();
		foreach ($arKeys as $key) {
			if (!is_numeric($key))
				continue;
			$ar[] = $key;
		}
		return $ar;
	}

	// Get key filter
	function GetKeyFilter() {
		$arKeys = $this->GetRecordKeys();
		$sKeyFilter = "";
		foreach ($arKeys as $key) {
			if ($sKeyFilter <> "") $sKeyFilter .= " OR ";
			$this->Id->CurrentValue = $key;
			$sKeyFilter .= "(" . $this->KeyFilter() . ")";
		}
		return $sKeyFilter;
	}

	// Load rows based on filter
	function &LoadRs($sFilter) {
		global $conn;

		// Set up filter (SQL WHERE clause) and get return SQL
		//$this->CurrentFilter = $sFilter;
		//$sSql = $this->SQL();

		$sSql = $this->GetSQL($sFilter, "");
		$rs = $conn->Execute($sSql);
		return $rs;
	}

	// Load row values from recordset
	function LoadListRowValues(&$rs) {
		$this->Id->setDbValue($rs->fields('Id'));
		$this->Fecha->setDbValue($rs->fields('Fecha'));
		$this->Plan->setDbValue($rs->fields('Plan'));
		$this->Estado->setDbValue($rs->fields('Estado'));
		$this->Descripcion->setDbValue($rs->fields('Descripcion'));
		$this->Origen->setDbValue($rs->fields('Origen'));
		$this->Destino->setDbValue($rs->fields('Destino'));
		$this->Chofer->setDbValue($rs->fields('Chofer'));
		$this->Vehiculo->setDbValue($rs->fields('Vehiculo'));
		$this->Pedido->setDbValue($rs->fields('Pedido'));
		$this->Carga->setDbValue($rs->fields('Carga'));
		$this->Descarga->setDbValue($rs->fields('Descarga'));
		$this->Retorno->setDbValue($rs->fields('Retorno'));
		$this->Observacion->setDbValue($rs->fields('Observacion'));
		$this->MostrarObservacion->setDbValue($rs->fields('MostrarObservacion'));
		$this->FechaActualizacion->setDbValue($rs->fields('FechaActualizacion'));
	}

	// Render list row values
	function RenderListRow() {
		global $conn, $Security;

		// Call Row Rendering event
		$this->Row_Rendering();

   // Common render codes
		// Id
		// Fecha
		// Plan
		// Estado
		// Descripcion
		// Origen
		// Destino
		// Chofer
		// Vehiculo
		// Pedido
		// Carga
		// Descarga
		// Retorno
		// Observacion
		// MostrarObservacion
		// FechaActualizacion
		// Id

		$this->Id->ViewValue = $this->Id->CurrentValue;
		$this->Id->ViewCustomAttributes = "";

		// Fecha
		$this->Fecha->ViewValue = $this->Fecha->CurrentValue;
		$this->Fecha->ViewValue = ew_FormatDateTime($this->Fecha->ViewValue, 7);
		$this->Fecha->ViewCustomAttributes = "";

		// Plan
		$this->Plan->ViewValue = $this->Plan->CurrentValue;
		if (strval($this->Plan->CurrentValue) <> "") {
			$sFilterWrk = "`PlanId`" . ew_SearchString("=", $this->Plan->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `PlanId`, `PlanDescripcion` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `plansemanal`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->Plan, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->Plan->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->Plan->ViewValue = $this->Plan->CurrentValue;
			}
		} else {
			$this->Plan->ViewValue = NULL;
		}
		$this->Plan->ViewValue = ew_FormatDateTime($this->Plan->ViewValue, 7);
		$this->Plan->ViewCustomAttributes = "";

		// Estado
		if (strval($this->Estado->CurrentValue) <> "") {
			switch ($this->Estado->CurrentValue) {
				case $this->Estado->FldTagValue(1):
					$this->Estado->ViewValue = $this->Estado->FldTagCaption(1) <> "" ? $this->Estado->FldTagCaption(1) : $this->Estado->CurrentValue;
					break;
				case $this->Estado->FldTagValue(2):
					$this->Estado->ViewValue = $this->Estado->FldTagCaption(2) <> "" ? $this->Estado->FldTagCaption(2) : $this->Estado->CurrentValue;
					break;
				case $this->Estado->FldTagValue(3):
					$this->Estado->ViewValue = $this->Estado->FldTagCaption(3) <> "" ? $this->Estado->FldTagCaption(3) : $this->Estado->CurrentValue;
					break;
				default:
					$this->Estado->ViewValue = $this->Estado->CurrentValue;
			}
		} else {
			$this->Estado->ViewValue = NULL;
		}
		$this->Estado->ViewCustomAttributes = "";

		// Descripcion
		$this->Descripcion->ViewValue = $this->Descripcion->CurrentValue;
		$this->Descripcion->ViewCustomAttributes = "";

		// Origen
		if (strval($this->Origen->CurrentValue) <> "") {
			switch ($this->Origen->CurrentValue) {
				case $this->Origen->FldTagValue(1):
					$this->Origen->ViewValue = $this->Origen->FldTagCaption(1) <> "" ? $this->Origen->FldTagCaption(1) : $this->Origen->CurrentValue;
					break;
				case $this->Origen->FldTagValue(2):
					$this->Origen->ViewValue = $this->Origen->FldTagCaption(2) <> "" ? $this->Origen->FldTagCaption(2) : $this->Origen->CurrentValue;
					break;
				case $this->Origen->FldTagValue(3):
					$this->Origen->ViewValue = $this->Origen->FldTagCaption(3) <> "" ? $this->Origen->FldTagCaption(3) : $this->Origen->CurrentValue;
					break;
				default:
					$this->Origen->ViewValue = $this->Origen->CurrentValue;
			}
		} else {
			$this->Origen->ViewValue = NULL;
		}
		$this->Origen->ViewCustomAttributes = "";

		// Destino
		if (strval($this->Destino->CurrentValue) <> "") {
			$sFilterWrk = "`sucursalId`" . ew_SearchString("=", $this->Destino->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `sucursalId`, `sucursalNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `sucursales`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->Destino, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->Destino->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->Destino->ViewValue = $this->Destino->CurrentValue;
			}
		} else {
			$this->Destino->ViewValue = NULL;
		}
		$this->Destino->ViewCustomAttributes = "";

		// Chofer
		if (strval($this->Chofer->CurrentValue) <> "") {
			$sFilterWrk = "`ChoId`" . ew_SearchString("=", $this->Chofer->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `ChoId`, `ChoNombre` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `choferes`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->Chofer, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->Chofer->ViewValue = $rswrk->fields('DispFld');
				$rswrk->Close();
			} else {
				$this->Chofer->ViewValue = $this->Chofer->CurrentValue;
			}
		} else {
			$this->Chofer->ViewValue = NULL;
		}
		$this->Chofer->ViewCustomAttributes = "";

		// Vehiculo
		if (strval($this->Vehiculo->CurrentValue) <> "") {
			$sFilterWrk = "`VehId`" . ew_SearchString("=", $this->Vehiculo->CurrentValue, EW_DATATYPE_NUMBER);
		$sSqlWrk = "SELECT `VehId`, `VehPatente` AS `DispFld`, `VehDescripcion` AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `vehiculos`";
		$sWhereWrk = "";
		if ($sFilterWrk <> "") {
			ew_AddFilter($sWhereWrk, $sFilterWrk);
		}

		// Call Lookup selecting
		$this->Lookup_Selecting($this->Vehiculo, $sWhereWrk);
		if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			if ($rswrk && !$rswrk->EOF) { // Lookup values found
				$this->Vehiculo->ViewValue = $rswrk->fields('DispFld');
				$this->Vehiculo->ViewValue .= ew_ValueSeparator(1,$this->Vehiculo) . $rswrk->fields('Disp2Fld');
				$rswrk->Close();
			} else {
				$this->Vehiculo->ViewValue = $this->Vehiculo->CurrentValue;
			}
		} else {
			$this->Vehiculo->ViewValue = NULL;
		}
		$this->Vehiculo->ViewCustomAttributes = "";

		// Pedido
		$this->Pedido->ViewValue = $this->Pedido->CurrentValue;
		$this->Pedido->ViewValue = ew_FormatDateTime($this->Pedido->ViewValue, 11);
		$this->Pedido->ViewCustomAttributes = "";

		// Carga
		$this->Carga->ViewValue = $this->Carga->CurrentValue;
		$this->Carga->ViewValue = ew_FormatDateTime($this->Carga->ViewValue, 11);
		$this->Carga->ViewCustomAttributes = "";

		// Descarga
		$this->Descarga->ViewValue = $this->Descarga->CurrentValue;
		$this->Descarga->ViewValue = ew_FormatDateTime($this->Descarga->ViewValue, 11);
		$this->Descarga->ViewCustomAttributes = "";

		// Retorno
		$this->Retorno->ViewValue = $this->Retorno->CurrentValue;
		$this->Retorno->ViewValue = ew_FormatDateTime($this->Retorno->ViewValue, 11);
		$this->Retorno->ViewCustomAttributes = "";

		// Observacion
		$this->Observacion->ViewValue = $this->Observacion->CurrentValue;
		$this->Observacion->ViewCustomAttributes = "";

		// MostrarObservacion
		if (strval($this->MostrarObservacion->CurrentValue) <> "") {
			$this->MostrarObservacion->ViewValue = "";
			$arwrk = explode(",", strval($this->MostrarObservacion->CurrentValue));
			$cnt = count($arwrk);
			for ($ari = 0; $ari < $cnt; $ari++) {
				switch (trim($arwrk[$ari])) {
					case $this->MostrarObservacion->FldTagValue(1):
						$this->MostrarObservacion->ViewValue .= $this->MostrarObservacion->FldTagCaption(1) <> "" ? $this->MostrarObservacion->FldTagCaption(1) : trim($arwrk[$ari]);
						break;
					default:
						$this->MostrarObservacion->ViewValue .= trim($arwrk[$ari]);
				}
				if ($ari < $cnt-1) $this->MostrarObservacion->ViewValue .= ew_ViewOptionSeparator($ari);
			}
		} else {
			$this->MostrarObservacion->ViewValue = NULL;
		}
		$this->MostrarObservacion->ViewCustomAttributes = "";

		// FechaActualizacion
		$this->FechaActualizacion->ViewValue = $this->FechaActualizacion->CurrentValue;
		$this->FechaActualizacion->ViewValue = ew_FormatDateTime($this->FechaActualizacion->ViewValue, 11);
		$this->FechaActualizacion->ViewCustomAttributes = "";

		// Id
		$this->Id->LinkCustomAttributes = "";
		$this->Id->HrefValue = "";
		$this->Id->TooltipValue = "";

		// Fecha
		$this->Fecha->LinkCustomAttributes = "";
		$this->Fecha->HrefValue = "";
		$this->Fecha->TooltipValue = "";

		// Plan
		$this->Plan->LinkCustomAttributes = "";
		$this->Plan->HrefValue = "";
		$this->Plan->TooltipValue = "";

		// Estado
		$this->Estado->LinkCustomAttributes = "";
		$this->Estado->HrefValue = "";
		$this->Estado->TooltipValue = "";

		// Descripcion
		$this->Descripcion->LinkCustomAttributes = "";
		$this->Descripcion->HrefValue = "";
		$this->Descripcion->TooltipValue = "";

		// Origen
		$this->Origen->LinkCustomAttributes = "";
		$this->Origen->HrefValue = "";
		$this->Origen->TooltipValue = "";

		// Destino
		$this->Destino->LinkCustomAttributes = "";
		$this->Destino->HrefValue = "";
		$this->Destino->TooltipValue = "";

		// Chofer
		$this->Chofer->LinkCustomAttributes = "";
		$this->Chofer->HrefValue = "";
		$this->Chofer->TooltipValue = "";

		// Vehiculo
		$this->Vehiculo->LinkCustomAttributes = "";
		$this->Vehiculo->HrefValue = "";
		$this->Vehiculo->TooltipValue = "";

		// Pedido
		$this->Pedido->LinkCustomAttributes = "";
		$this->Pedido->HrefValue = "";
		$this->Pedido->TooltipValue = "";

		// Carga
		$this->Carga->LinkCustomAttributes = "";
		$this->Carga->HrefValue = "";
		$this->Carga->TooltipValue = "";

		// Descarga
		$this->Descarga->LinkCustomAttributes = "";
		$this->Descarga->HrefValue = "";
		$this->Descarga->TooltipValue = "";

		// Retorno
		$this->Retorno->LinkCustomAttributes = "";
		$this->Retorno->HrefValue = "";
		$this->Retorno->TooltipValue = "";

		// Observacion
		$this->Observacion->LinkCustomAttributes = "";
		$this->Observacion->HrefValue = "";
		$this->Observacion->TooltipValue = "";

		// MostrarObservacion
		$this->MostrarObservacion->LinkCustomAttributes = "";
		$this->MostrarObservacion->HrefValue = "";
		$this->MostrarObservacion->TooltipValue = "";

		// FechaActualizacion
		$this->FechaActualizacion->LinkCustomAttributes = "";
		$this->FechaActualizacion->HrefValue = "";
		$this->FechaActualizacion->TooltipValue = "";

		// Call Row Rendered event
		$this->Row_Rendered();
	}

	// Aggregate list row values
	function AggregateListRowValues() {
	}

	// Aggregate list row (for rendering)
	function AggregateListRow() {
	}

	// Export data in HTML/CSV/Word/Excel/Email/PDF format
	function ExportDocument(&$Doc, &$Recordset, $StartRec, $StopRec, $ExportPageType = "") {
		if (!$Recordset || !$Doc)
			return;

		// Write header
		$Doc->ExportTableHeader();
		if ($Doc->Horizontal) { // Horizontal format, write header
			$Doc->BeginExportRow();
			if ($ExportPageType == "view") {
				if ($this->Id->Exportable) $Doc->ExportCaption($this->Id);
				if ($this->Fecha->Exportable) $Doc->ExportCaption($this->Fecha);
				if ($this->Plan->Exportable) $Doc->ExportCaption($this->Plan);
				if ($this->Estado->Exportable) $Doc->ExportCaption($this->Estado);
				if ($this->Descripcion->Exportable) $Doc->ExportCaption($this->Descripcion);
				if ($this->Origen->Exportable) $Doc->ExportCaption($this->Origen);
				if ($this->Destino->Exportable) $Doc->ExportCaption($this->Destino);
				if ($this->Chofer->Exportable) $Doc->ExportCaption($this->Chofer);
				if ($this->Vehiculo->Exportable) $Doc->ExportCaption($this->Vehiculo);
				if ($this->Pedido->Exportable) $Doc->ExportCaption($this->Pedido);
				if ($this->Carga->Exportable) $Doc->ExportCaption($this->Carga);
				if ($this->Descarga->Exportable) $Doc->ExportCaption($this->Descarga);
				if ($this->Retorno->Exportable) $Doc->ExportCaption($this->Retorno);
				if ($this->Observacion->Exportable) $Doc->ExportCaption($this->Observacion);
				if ($this->MostrarObservacion->Exportable) $Doc->ExportCaption($this->MostrarObservacion);
				if ($this->FechaActualizacion->Exportable) $Doc->ExportCaption($this->FechaActualizacion);
			} else {
				if ($this->Id->Exportable) $Doc->ExportCaption($this->Id);
				if ($this->Fecha->Exportable) $Doc->ExportCaption($this->Fecha);
				if ($this->Plan->Exportable) $Doc->ExportCaption($this->Plan);
				if ($this->Estado->Exportable) $Doc->ExportCaption($this->Estado);
				if ($this->Descripcion->Exportable) $Doc->ExportCaption($this->Descripcion);
				if ($this->Origen->Exportable) $Doc->ExportCaption($this->Origen);
				if ($this->Destino->Exportable) $Doc->ExportCaption($this->Destino);
				if ($this->Chofer->Exportable) $Doc->ExportCaption($this->Chofer);
				if ($this->Vehiculo->Exportable) $Doc->ExportCaption($this->Vehiculo);
				if ($this->Pedido->Exportable) $Doc->ExportCaption($this->Pedido);
				if ($this->Carga->Exportable) $Doc->ExportCaption($this->Carga);
				if ($this->Descarga->Exportable) $Doc->ExportCaption($this->Descarga);
				if ($this->Retorno->Exportable) $Doc->ExportCaption($this->Retorno);
				if ($this->Observacion->Exportable) $Doc->ExportCaption($this->Observacion);
				if ($this->MostrarObservacion->Exportable) $Doc->ExportCaption($this->MostrarObservacion);
				if ($this->FechaActualizacion->Exportable) $Doc->ExportCaption($this->FechaActualizacion);
			}
			$Doc->EndExportRow();
		}

		// Move to first record
		$RecCnt = $StartRec - 1;
		if (!$Recordset->EOF) {
			$Recordset->MoveFirst();
			if ($StartRec > 1)
				$Recordset->Move($StartRec - 1);
		}
		while (!$Recordset->EOF && $RecCnt < $StopRec) {
			$RecCnt++;
			if (intval($RecCnt) >= intval($StartRec)) {
				$RowCnt = intval($RecCnt) - intval($StartRec) + 1;

				// Page break
				if ($this->ExportPageBreakCount > 0) {
					if ($RowCnt > 1 && ($RowCnt - 1) % $this->ExportPageBreakCount == 0)
						$Doc->ExportPageBreak();
				}
				$this->LoadListRowValues($Recordset);

				// Render row
				$this->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->ResetAttrs();
				$this->RenderListRow();
				$Doc->BeginExportRow($RowCnt); // Allow CSS styles if enabled
				if ($ExportPageType == "view") {
					if ($this->Id->Exportable) $Doc->ExportField($this->Id);
					if ($this->Fecha->Exportable) $Doc->ExportField($this->Fecha);
					if ($this->Plan->Exportable) $Doc->ExportField($this->Plan);
					if ($this->Estado->Exportable) $Doc->ExportField($this->Estado);
					if ($this->Descripcion->Exportable) $Doc->ExportField($this->Descripcion);
					if ($this->Origen->Exportable) $Doc->ExportField($this->Origen);
					if ($this->Destino->Exportable) $Doc->ExportField($this->Destino);
					if ($this->Chofer->Exportable) $Doc->ExportField($this->Chofer);
					if ($this->Vehiculo->Exportable) $Doc->ExportField($this->Vehiculo);
					if ($this->Pedido->Exportable) $Doc->ExportField($this->Pedido);
					if ($this->Carga->Exportable) $Doc->ExportField($this->Carga);
					if ($this->Descarga->Exportable) $Doc->ExportField($this->Descarga);
					if ($this->Retorno->Exportable) $Doc->ExportField($this->Retorno);
					if ($this->Observacion->Exportable) $Doc->ExportField($this->Observacion);
					if ($this->MostrarObservacion->Exportable) $Doc->ExportField($this->MostrarObservacion);
					if ($this->FechaActualizacion->Exportable) $Doc->ExportField($this->FechaActualizacion);
				} else {
					if ($this->Id->Exportable) $Doc->ExportField($this->Id);
					if ($this->Fecha->Exportable) $Doc->ExportField($this->Fecha);
					if ($this->Plan->Exportable) $Doc->ExportField($this->Plan);
					if ($this->Estado->Exportable) $Doc->ExportField($this->Estado);
					if ($this->Descripcion->Exportable) $Doc->ExportField($this->Descripcion);
					if ($this->Origen->Exportable) $Doc->ExportField($this->Origen);
					if ($this->Destino->Exportable) $Doc->ExportField($this->Destino);
					if ($this->Chofer->Exportable) $Doc->ExportField($this->Chofer);
					if ($this->Vehiculo->Exportable) $Doc->ExportField($this->Vehiculo);
					if ($this->Pedido->Exportable) $Doc->ExportField($this->Pedido);
					if ($this->Carga->Exportable) $Doc->ExportField($this->Carga);
					if ($this->Descarga->Exportable) $Doc->ExportField($this->Descarga);
					if ($this->Retorno->Exportable) $Doc->ExportField($this->Retorno);
					if ($this->Observacion->Exportable) $Doc->ExportField($this->Observacion);
					if ($this->MostrarObservacion->Exportable) $Doc->ExportField($this->MostrarObservacion);
					if ($this->FechaActualizacion->Exportable) $Doc->ExportField($this->FechaActualizacion);
				}
				$Doc->EndExportRow();
			}
			$Recordset->MoveNext();
		}
		$Doc->ExportTableFooter();
	}

	// Table level events
	// Recordset Selecting event
	function Recordset_Selecting(&$filter) {

		// Enter your code here	
	}

	// Recordset Selected event
	function Recordset_Selected(&$rs) {

		//echo "Recordset Selected";
	}

	// Recordset Search Validated event
	function Recordset_SearchValidated() {

		// Example:
		//$this->MyField1->AdvancedSearch->SearchValue = "your search criteria"; // Search value

	}

	// Recordset Searching event
	function Recordset_Searching(&$filter) {

		// Enter your code here	
	}

	// Row_Selecting event
	function Row_Selecting(&$filter) {

		// Enter your code here	
	}

	// Row Selected event
	function Row_Selected(&$rs) {

		//echo "Row Selected";
	}

	// Row Inserting event
	function Row_Inserting($rsold, &$rsnew) {

		// Enter your code here
		// To cancel, set return value to FALSE

		return TRUE;
	}

	// Row Inserted event
	function Row_Inserted($rsold, &$rsnew) {

		//echo "Row Inserted"   
		$MyResult = ew_Execute("UPDATE planoperaciones SET FechaActualizacion='".date("Y-m-d H:i:s")."' WHERE Id=".$rsold['Id']);
		}                                                                                                           

	// Row Updating event
	function Row_Updating($rsold, &$rsnew) {

		// Enter your code here
		// To cancel, set return value to FALSE

		return TRUE;
	}

	// Row Updated event
	function Row_Updated($rsold, &$rsnew) {

		//echo "Row Updated";    
		   //echo "UPDATE planoperaciones SET FechaActualizacion=".date("Y-m-d h:i:s")." WHERE Id=".$rsold['Id'];

		 $MyResult = ew_Execute("UPDATE planoperaciones SET FechaActualizacion='".date("Y-m-d H:i:s")."' WHERE Id=".$rsold['Id']);
	}

	// Row Update Conflict event
	function Row_UpdateConflict($rsold, &$rsnew) {

		// Enter your code here
		// To ignore conflict, set return value to FALSE

		return TRUE;
	}

	// Row Deleting event
	function Row_Deleting(&$rs) {

		// Enter your code here
		// To cancel, set return value to False

		return TRUE;
	}

	// Row Deleted event
	function Row_Deleted(&$rs) {

		//echo "Row Deleted";
	}

	// Email Sending event
	function Email_Sending(&$Email, &$Args) {

		//var_dump($Email); var_dump($Args); exit();
		return TRUE;
	}

	// Lookup Selecting event
	function Lookup_Selecting($fld, &$filter) {

		// Enter your code here
	}

	// Row Rendering event
	function Row_Rendering() {

		// Enter your code here	
	}

	// Row Rendered event
	function Row_Rendered() {

		// To view properties of field class, use:
		//var_dump($this-><FieldName>); 

	}

	// User ID Filtering event
	function UserID_Filtering(&$filter) {

		// Enter your code here
	}
}
?>
